package com.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.mapper.db2.TeacherTableMapper;
import com.util.SpringContextUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * <p>
 * 
 * </p>
 *
 * @author chl
 * @since 2022-03-22
 */
@Data
public class TeacherTableDto  implements Callable<List> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private Long id;

    /**
     * 老师名字
     */
    private String teacherName;

    /**
     * 老师编号
     */
    private String teacherNo;

    /**
     * 老师地址
     */
    private String teacherAddress;

    /**
     * 创建时间
     */
    private Date createTime;

    //每个线程查询出来的数据集合
    private List<TeacherTableDto> datas;


    public TeacherTableDto() {
    }

    public static SpringContextUtil springContextUtil = new SpringContextUtil();
    public TeacherTableDto(int start, int end) {
//        this.start=start;
//        this.end=end;
        //每个线程查询出来的数据集合
//        QueryService queryService= springContextUtil.getBean("queryService");
        //上面获取bean实例的方法可能会失效
        TeacherTableMapper blogService = SpringContextUtil.getBean(TeacherTableMapper.class);
        List<TeacherTableDto> count = blogService.getPageList(start,end);
        datas = count;
    }


    @Override
    public List<TeacherTableDto> call() throws Exception {
        return datas;
    }
}
